The section describes the programming interface of the I2C master mode Peripheral driver.
More...
|
| void | i2c_master_init (uint32_t instance, i2c_master_t *master) |
| | Initialize the I2C master mode driver. More...
|
| |
| void | i2c_master_shutdown (i2c_master_t *master) |
| | Shut down the driver. More...
|
| |
| i2c_status_t | i2c_master_configure_bus (i2c_master_t *master, const i2c_device_t *device) |
| | Configure the I2C bus to access a device. More...
|
| |
| i2c_status_t | i2c_master_transfer_basic (i2c_master_t *master, uint32_t flags, i2c_direction_t direction, uint8_t *data, size_t dataLength, size_t *actualLengthTransferred, uint32_t timeout_ms) |
| | Low-level I2C transfer function. More...
|
| |
| i2c_status_t | i2c_master_transfer (i2c_master_t *master, const i2c_device_t *device, i2c_direction_t direction, bool stopAfterTransfer, uint32_t subaddress, size_t subaddressLength, uint8_t *data, size_t dataLength, size_t *actualLengthTransferred, uint32_t timeout_ms) |
| | Perform a blocking read or write transaction on the I2C bus. More...
|
| |
| uint8_t i2c_device_t::address |
| uint32_t i2c_device_t::baudRate_kbps |
- Note
- The contents of this structure are internal to the driver and should not be modified by users. Also, contents of the structure are subject to change in future releases.
Data Fields |
|
uint32_t | instance |
| |
|
bool | isTransferInProgress |
| |
|
uint32_t | flags |
| |
|
i2c_direction_t | direction |
| |
|
uint8_t * | data |
| |
|
volatile size_t | dataRemainingCount |
| |
|
volatile size_t | bytesTransferredCount |
| |
|
volatile bool | gotNak |
| |
|
uint32_t | lastBaudRate_kbps |
| |
|
sync_object_t | irqSync |
| |
| Enumerator |
|---|
| kI2CRead |
Read from slave device.
|
| kI2CWrite |
Write to slave device.
|
| Enumerator |
|---|
| kI2CNoStart |
Set this flag to prevent sending a START signal.
|
| kI2CNoStop |
Set this flag to prevent sending a STOP signal.
|
| void i2c_master_init |
( |
uint32_t |
instance, |
|
|
i2c_master_t * |
master |
|
) |
| |
- Parameters
-
| instance | The I2C peripheral instance number. |
| master | The pointer to the I2C master driver state structure. |
- Parameters
-
| master | The pointer to the I2C master driver state structure. |
- Parameters
-
| master | The pointer to the I2C master driver state structure. |
| device | The pointer to the I2C device information struct. |
| i2c_status_t i2c_master_transfer_basic |
( |
i2c_master_t * |
master, |
|
|
uint32_t |
flags, |
|
|
i2c_direction_t |
direction, |
|
|
uint8_t * |
data, |
|
|
size_t |
dataLength, |
|
|
size_t * |
actualLengthTransferred, |
|
|
uint32_t |
timeout_ms |
|
) |
| |
- Parameters
-
| master | The pointer to the I2C master driver state structure. |
| flags | The flags to control a transfer. |
| direction | The direction of an I2C transfer. |
| data | The pointer to the data to be transfered. |
| dataLength | The length in bytes of the data to be transfered. |
| actualLengthTransferred | The length in bytes of the data thansfered. |
| timeous_ms | A timeout for the transfer in microseconds. |
| i2c_status_t i2c_master_transfer |
( |
i2c_master_t * |
master, |
|
|
const i2c_device_t * |
device, |
|
|
i2c_direction_t |
direction, |
|
|
bool |
stopAfterTransfer, |
|
|
uint32_t |
subaddress, |
|
|
size_t |
subaddressLength, |
|
|
uint8_t * |
data, |
|
|
size_t |
dataLength, |
|
|
size_t * |
actualLengthTransferred, |
|
|
uint32_t |
timeout_ms |
|
) |
| |
- Parameters
-
| master | The pointer to the I2C master driver state structure. |
| device | The pointer to the I2C device information struct. |
| direction | The direction of an I2C transfer. |
| stopAfterTransfer | Send STOP signal after this transfer or not. |
| subaddress | The subaddress for a device if it has. |
| subaddressLength | The length of the subaddress. |
| data | The pointer to the data to be transfered. |
| dataLength | The length in bytes of the data to be transfered. |
| actualLengthTransferred | The length in bytes of the data thansfered. |
| timeous_ms | A timeout for the transfer in microseconds. |